package com.share.wechat.core.repository.inter;

import com.share.wechat.core.entity.Groom;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface GroomRepository extends CrudRepository<Groom, String> {
    /**
     * 根据积分高低查找 分页 20 默认倒叙
     *
     * @param pageable 分页
     * @return 结果
     */
    @Query("select m from Groom m order by m.score desc ")
    Page<Groom> findBySort(Pageable pageable);

    /**
     * 根据分类查找当前推荐
     *
     * @param dataSort 分类
     * @param pageable 分页
     * @return Page
     */
    Page<Groom> findByDataSort(int dataSort, Pageable pageable);

    /**
     * 根据ids查找
     * @param ids id集合
     * @return List
     */
    List<Groom> findByIdIn(List<String> ids);



}
